home *** CD-ROM | disk | FTP | other *** search
- ;/*
- sc StarField.c DATA=FAR NMINC STRMERGE NOSTKCHK IGNORE=73 STRUCTUREEQUIVALENCE NOSTDIO
- slink from LIB:c.o StarField.o to //Clients/StarField LIB LIB:sc.lib LIB:amiga.lib /lib/client.lib SC SD NOICONS STRIPDEBUG
- delete starfield.o
- quit
-
- StarField 1.2 (Client for BServer)
-
- Copyright © 1994 by Stefano Reksten of 3AM - The Three Amigos!!!
- All rights reserved.
- */
-
- #include <exec/types.h>
- #include <intuition/intuition.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/alib_protos.h>
-
- #include "/include/client.h"
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
-
- struct DisplayIDInformation *dinfo;
-
- struct Screen *scr;
-
- UWORD Stars[512][2];
-
-
- void DrawStars( void )
- {
- UWORD n, tmpx, trnd, swidth, sheight;
- struct Rectangle *rect;
- register PLANEPTR plane0, plane1;
- register UWORD last_star;
-
- rect = GETTXTOSCANRECT(dinfo);
-
- swidth = RECTANGLEWIDTH(rect);
- sheight = RECTANGLEHEIGHT(rect);
-
- if ( DISPLAYID( dinfo ) & LACE )
- last_star = ( sheight > 512 ? 512 : sheight );
- else
- last_star = ( sheight > 256 ? 256 : sheight );
-
- swidth = (swidth>>8)<<8;
-
- if ( scr = OpenScreenTags( NULL,
- SA_DisplayID, DISPLAYID( dinfo ),
- SA_Width, swidth,
- SA_Height, sheight,
- SA_Left, (RECTANGLEWIDTH(rect) - swidth)/2,
- SA_Top, 0,
- SA_Depth, 2,
- SA_Overscan, OSCAN_TEXT,
- SA_Type, CUSTOMSCREEN,
- SA_Quiet, TRUE,
- TAG_END ) )
- {
- register struct ViewPort *vp = &(scr->ViewPort);
-
- SpritesOff();
-
- SetRGB4( vp, 0, 0, 0, 0 );
- SetRGB4( vp, 1, 3, 3, 3 );
- SetRGB4( vp, 2, 6, 6, 6 );
- SetRGB4( vp, 3, 9, 9, 9 );
-
- for ( n = 0; n < last_star; n++ )
- {
- Stars[n][0] = RangeRand(swidth-1);
- Stars[n][1] = RangeRand( 7 );
- }
-
- while( STILL_BLANKING )
- {
- /* Draw stars */
- plane0 = scr->RastPort.BitMap->Planes[0];
- plane1 = scr->RastPort.BitMap->Planes[1];
-
- WaitTOF();
- for ( n = 0; n < last_star; n++ )
- {
- * (plane0 + (Stars[n][0]>>3) ) = 0;
- * (plane1 + (Stars[n][0]>>3) ) = 0;
-
- tmpx = Stars[n][0] + Stars[n][1];
- if ( tmpx >= swidth )
- {
- while ( !(trnd = RangeRand( 7 ) ) );
- Stars[n][0] = 0;
- Stars[n][1] = trnd;
- }
- else Stars[n][0] = tmpx;
-
- if ( Stars[n][1]>>1 & 1 )
- * (plane0 + (Stars[n][0]>>3) ) = 128>>(Stars[n][0] & 7);
- if ( Stars[n][1]>>1 & 2 )
- * (plane1 + (Stars[n][0]>>3) ) = 128>>(Stars[n][0] & 7);
-
- plane0 += swidth >>3;
- plane1 += swidth >>3;
- }
- }
- CloseScreen( scr );
- SpritesOn();
- }
- else
- SendClientMsg( ACTION_FAILED );
- }
-
- void __main( char *line )
- {
- if ( IntuitionBase = (struct IntuitionBase *)OpenLibrary( "intuition.library", 37L ) )
- {
- if ( GfxBase = (struct GfxBase *)OpenLibrary( "graphics.library", 37L ) )
- {
- if ( dinfo = OpenCommunication() )
- {
- DrawStars();
- CloseCommunication( dinfo );
- }
- CloseLibrary( (struct Library *)GfxBase );
- }
- CloseLibrary( (struct Library *)IntuitionBase );
- }
- }
-